<template>
	<view>
		<view class="notice-bar">
			<image src="@/static/nursery/index/notice.png" mode="" class="logo"></image>
			<view class="text-list">
				<swiper 
					:autoplay="true" 
					:interval="3000" 
					:duration="1000"
					:vertical="true"
					:circular="true"
					style="height:60rpx"
				>
					<swiper-item v-for="(item,index) in noticeList" :key="index" @click="goDetail(item.id)">
						<text class="text">{{ item.title }}</text>
					</swiper-item>
				</swiper>
			</view>
		</view>
	</view>
</template>

<script lang="ts" setup>
	const props = defineProps({
		noticeList:{
			type: [Array],
			default: []
		}
	})
	const goDetail = (id) => {
		uni.navigateTo({
			url: `/pages/noticeDetail/notice-detail?id=${id}`
		})
	}
</script>

<style lang="scss" scoped>
	.notice-bar{
		width: mp-sizing(345);
		display: flex;
		align-items: center;
		margin: mp-sizing(10) 0;
		padding: mp-sizing(10);
		background-color: $uni-bg-color;
		margin: auto;
		border-radius: mp-sizing(10);
		box-sizing: border-box;
		.logo{
			flex-basis: 10%;
			width: mp-sizing(30);
			height: mp-sizing(30);
		}
		.text-list{
			flex-basis: 90%;
			height: mp-sizing(30);
			margin-left: mp-sizing(15);
			.text{
				width: 100%;
				height: 100%;
				line-height: mp-sizing(30);
				overflow: hidden;
				white-space: nowrap;
				text-overflow: ellipsis;
			}
		}
	}
</style>